<style>
    .layui-form-pane .layui-form-label{width:auto;}
    .layui-form-item{margin-bottom: 0px;}
    .order-time-bg{background-color:#1E9FFF;color:white;padding:0px 5px;}
    .order-num span{display:inline-block;min-width:25px;margin:0px 2px;text-align:center;}
    .dress_line_code{margin-top:6px;}
    .dress_line_code textarea{height:100px;padding:6px;width:578px}
    .submit_block{padding-left:230px;}
    .checkInNumSpan{text-decoration:underline;}
    .checkin_ret{text-align:center;padding-top:30px;}
    .scan_code_ret{color:red;font-weight:bold;margin-bottom:6px;}
    .defective_reason{padding:3px 2px;}
    .defective_reason input{padding:2px 4px;}
    .layui-table-cell{line-height:21px;}
</style>
<div class="layui-collapse">
    <div class="layui-colla-item caigou">
        <h2 class="layui-colla-title">
            {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'dispatching'}
            <a href="{:url('mp/OutNodeProgress/dispatching')}" class="layui-btn layui-btn-sm layui-btn-normal" style="margin-left: 30px;">待派工</a>
            {else /}
            <a href="{:url('mp/OutNodeProgress/dispatching')}" class="layui-btn layui-btn-sm layui-btn-primary" style="margin-left: 30px;">待派工</a>
            {/if}
        </h2>
        <div class="layui-colla-content layui-show">
            <div>节点筛选：
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'index'}
                <a href="{:url('mp/OutNodeProgress/index')}" class="layui-btn layui-btn-sm layui-btn-normal">采购</a>
                {else /}
                <a href="{:url('mp/OutNodeProgress/index')}" class="layui-btn layui-btn-sm layui-btn-primary">采购</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'cutting'}
                》<a href="{:url('mp/OutNodeProgress/cutting')}" class="layui-btn layui-btn-sm layui-btn-normal">裁剪中</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/cutting')}" class="layui-btn layui-btn-sm layui-btn-primary">裁剪中</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'waitdeliver'}
                》<a href="{:url('mp/OutNodeProgress/waitDeliver')}" class="layui-btn layui-btn-sm layui-btn-normal">待发货</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/waitDeliver')}" class="layui-btn layui-btn-sm layui-btn-primary">待发货</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'sewing'}
                》<a href="{:url('mp/OutNodeProgress/sewing')}" class="layui-btn layui-btn-sm layui-btn-normal">车缝中</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/sewing')}" class="layui-btn layui-btn-sm layui-btn-primary">车缝中</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'afterfinishing'}
                》<a href="{:url('mp/OutNodeProgress/afterFinishing')}" class="layui-btn layui-btn-sm layui-btn-normal">后整中</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/afterFinishing')}" class="layui-btn layui-btn-sm layui-btn-primary">后整中</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'finishreturn'}
                》<a href="{:url('mp/OutNodeProgress/finishReturn')}" class="layui-btn layui-btn-sm layui-btn-normal">已退货</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/finishReturn')}" class="layui-btn layui-btn-sm layui-btn-primary">已退货</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'outgotail'}
                》<a href="{:url('mp/OutNodeProgress/outgoTail')}" class="layui-btn layui-btn-sm layui-btn-normal">外协尾部</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/outgoTail')}" class="layui-btn layui-btn-sm layui-btn-primary">外协尾部</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'allfinish'}
                》<a href="{:url('mp/OutNodeProgress/allFinish')}" class="layui-btn layui-btn-sm layui-btn-normal">已完成</a>
                {else /}
                》<a href="{:url('mp/OutNodeProgress/allFinish')}" class="layui-btn layui-btn-sm layui-btn-primary">已完成</a>
                {/if}

                <!--按钮-->
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'waitdeliver'}
                <a  href="javascript:void(0)" title="确认发货" class="onclickSendDeliver layui-btn layui-btn-warm layui-btn-sm " style="float:right;" >确认发货</a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'sewing'}
                <a  href="javascript:void(0)" title="确认回货" class="onclickSewing layui-btn layui-btn-warm layui-btn-sm " style="float:right;" >确认回货</a>
                <a href="javascript:void(0)" class="hisi-iframe onclickReturnGoods-hisi-iframe hide" title="确认回货" hisi-data="{width: '1260px', height: '600px'}" ></a>
                {/if}
                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'afterfinishing'}
                <a  onclick="onclickOtherBtn(this)" title="其它操作" id="onclickOtherBtn" class=" layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FF5722;" >
                    其它操作
                </a>
                <a  href="javascript:void(0)" title="尾部完成" class="tail-done layui-btn layui-btn-warm layui-btn-sm   " style="float:right;background-color: #00564e;" >尾部完成</a>
                <!--                <a  href="javascript:void(0)" title="发起外协" class="onclickOpenOutgo layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #009688;" >发起外协</a>-->
                <a  href="javascript:void(0)" title="退货" class="onclickReturnGoods layui-btn layui-btn-warm layui-btn-sm   " style="float:right;" >退货</a>
                <a  href="javascript:void(0)" title="回货" class="onclickconfirmReturnGoodsViewV2 layui-btn layui-btn-warm layui-btn-sm   " style="float:right;background-color: #1E9FFF;" >回货</a>

                <a href="javascript:void(0)" class="hisi-iframe onclickReturnGoods-hisi-iframe hide" title="选择退货类型" hisi-data="{width: '860px', height: '300px'}" ></a>
                <a href="javascript:void(0)" class="hisi-iframe onclickReturnGoods-hisi-iframe-v2 hide" title="确认回货" hisi-data="{width: '1260px', height: '600px'}" ></a>
                {/if}

                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'finishreturn'}
                <a  href="javascript:void(0)" title="确认回货" class="onclickSewing layui-btn layui-btn-warm layui-btn-sm " style="float:right;" >确认回货</a>
                {/if}

                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'outgotail'}
                <a  href="javascript:void(0)" title="确认回货" class="onclickSewing layui-btn layui-btn-warm layui-btn-sm " style="float:right;" >确认回货</a>
                {/if}

                {if $Request.controller == 'OutNodeProgress' &&  $Request.action == 'allfinish'}
                <a  onclick="onclickOtherBtn(this)" title="其它操作" id="onclickOtherBtn" class=" layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FF5722;" >
                    其它操作
                </a>
                <a href="javascript:void(0)"  class="hisi-iframe onclick-delivery-sync-hisi-iframe hide" title="查看发货单" hisi-data="{width: '1260px', height: '600px'}" ></a>
                <!--                <a href="{:url('deliveryList')}?order_id={{ d.id }}" title="查看发货单" class="hisi-iframe layui-btn layui-btn-sm layui-btn-primary">查看发货单</a>-->
                {/if}
            </div>
        </div>
    </div>
</div>

<div id="otherButtonTpl"  class="hide">
    <table class="layui-table small-table">
        <tbody>
        <tr class="top">
            <td>
                <a href="javascript:void(0)" title="调用库存" class="tail-stock-out layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FFB800;">调用库存</a>
            </td>
            <td>
                <a href="javascript:void(0)" title="发起外协" class="onclickOpenOutgo layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #009688;">发起外协</a>
            </td>
        </tr>
        <tr class="foot">
            <td>
                <a href="javascript:void(0)" title="库存录入" stocktype="not_defective" class="tail-stock-outin layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #1E9FFF;">库存录入</a>
            </td>
            <td>
                <a href="javascript:void(0)" title="同步发货单" class="layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FFB800;">同步发货单</a>
            </td>
        </tr>
        <tr class="foot">
            <td>
                <a href="javascript:void(0)" title="次品录入" stocktype="defective" class="tail-stock-outin layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FF5722;">次品录入</a>
            </td>
            <td>

            </td>
        </tr>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    var request_controller = '{$Request.controller}';
    var request_action = '{$Request.action}';
    //动态显示pv
    if(typeof  window.parent.pv_uv_str_ext == 'function' ) {
        window.parent.pv_uv_str_ext(0, 'mp/' + request_controller + '/' + request_action);
    }
    //状态统计信息显示
    function status_sum(res,page) {
        if (res.code > 0) {
            return true;
        }
        var temp='';
        if(res['status_sum'].length>0){
            $.each(res.status_sum ,function (k,v)   {
                temp+=v.name+'('+v.count+'单-'+v.sum_quantity+'件)'+'\xa0\xa0\xa0\xa0';
            });
            vm.$data.status_sum=temp;
        }else{
            if(page==1){
                vm.$data.status_sum='';
            }
        }
    }
    /**
     * 获取选择订单的数据
     * @param count 0所有 1只是一单信息
     */
    function get_select_data(count=0) {
        select_data={};
        $.each(res_data ,function (k,v)   {
            $.each(send_stock ,function (k2,v2)   {
                if(k== ('_'+k2)){
                    var temp={};
                    temp[k]=v;
                    select_data=$.extend(select_data,temp);
                }
            });
        });
        if(count==1){
            var info;
            $.each(select_data ,function (k,v)   {
                return info=v;
            });
            return info;
        }
        return select_data;
    }
    //判断是否只选择一个订单
    function select_limit_one() {
        var count=0;
        $.each(send_stock ,function (k2,v2)   {
            count++;
        });
        if(count==1){
            return true;
        }
        return false;
    }

    //订单进度与码数信息
    function getOrderDetail(order_id) {
        $.ajax({
            type: "POST",
            url: "{:url('mp/OutNodeProgress/getOrderDetail')}?order_id="+order_id,
            dataType:"json",
            success: function(res){
                var table=res.data;
                tip_index=layer.tips(table,"#getOrderDetail-"+order_id+"",{tips:[3, '#fff'],area: ['auto', 'auto'],time:10000});
                $("#getOrderDetail-"+order_id+"").mouseleave(function(){
                    layer.close(tip_index);
                });
            }
        });
    }
    //其它操作显示
    var tip_onclickOtherBtn;
    $("#onclickOtherBtn").data("show",0);
    function onclickOtherBtn(obj) {
        if($("#onclickOtherBtn").data("show")==1){
            layer.close(tip_onclickOtherBtn);
            $("#onclickOtherBtn").data("show",0);
            return true;
        }
        $("#onclickOtherBtn").data("show",1);

        var html='<table class="layui-table small-table">\n' +
            '    <tbody>\n' +
            '    <tr class="top">\n' +
            '<td>' +
            '<a  href="javascript:void(0)" title="调用库存" class="tail-stock-out layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FFB800;" >调用库存</a>' +
            '</td>';
        //发起外协
        if(request_action=='afterfinishing'){
            html+= '<td>' +
                '<a  href="javascript:void(0)" title="发起外协" class="onclickOpenOutgo layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #009688;" >发起外协</a>' +
                '</td>' ;
        }else{
            html+='<td>' +
                '<a  href="javascript:void(0)" title="查看发货单" data-option="find" class="delivery-sync layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FFB800;"  >查看发货单</a>' +
                '</td>';
        }
        html+='</tr>' +
            '    <tr class="foot">' +
            '<td>' +
            '<a  href="javascript:void(0)" title="库存录入" stocktype="not_defective" class="tail-stock-outin layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #1E9FFF;" >库存录入</a>' +
            '</td>';
        //同步发货单
        if(request_action=='allfinish'){
            html+= '<td>' +
                '<a  href="javascript:void(0)" title="同步发货单" data-option="sync" class="delivery-sync layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FFB800;" >同步发货单</a>' +
                '</td>';
        }else{
            html+='<td>' +
                '</td>';
        }
        html+='</tr>' +
            '<tr class="foot">' +
            '<td>' +
            '<a  href="javascript:void(0)" title="次品录入" stocktype="defective" class="tail-stock-outin layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #FF5722;" >次品录入</a>' +
            '</td>';
        //加入成品统计  尾部完成才有这按钮
        if(request_action=='allfinish'){
            html+='<td>' +
                '<a  href="javascript:void(0)" title="加入成品统计" class="tail-defective layui-btn layui-btn-warm layui-btn-sm " style="float:right;background-color: #009688;" >加入成品统计</a>' +
                '</td>';
        }else{
            html+='<td>' +
                '</td>';
        }
        html+='    </tr>' +
            '    </tbody>' +
            '</table>';

        // var d = [];
        // d['request_action'] = request_action;
        // var content = laytpl($('#otherButtonTpl').html()).render(d);
        tip_onclickOtherBtn=layer.tips(html,"#onclickOtherBtn",{tips:[1, '#fff'],area: ['auto', 'auto'],time:30000});
    }
</script>